<table class="commissionTable">
<tr>
	<th>Funkcia</th>
	<th>Meno</th>
	<th>Akcia</th>
</tr>
<?php
foreach($this->commission as $commission):	
	foreach($commission->getProfessors() as $professor):?>
		<tr id="<?php echo $commission['cid'] . '-' . $professor['pid'];?>">
			<td class="left">
				<?php
				$params = array(
					'url' => $this->url(array(
						'action' => 'set-role',
						'controller' => 'commission',
						'format' => 'html',
						'cid' => $commission->getCid(),
						'pid' => $professor->getPid(),
						)					
					),
					'update' => '.message',
					'format' => 'html'
				);				
				
				$professorCommissionMapper = new Db_Mapper_ProfessorCommission();
				$professorCommissionModel = $professorCommissionMapper->fetchRole($professor,$commission);

				
				
				echo new Form_Commission_SetRole(
					'role' . $commission->getCid() . $professor->getPid(),
					$params,
					$professorCommissionModel->getRole()				
				);		
			?>
			</td>
			<td class="left">
				<?php echo 
				$professor['title_before'] . ' ' . 
				$professor['firstname'] . ' ' . 
				$professor['lastname'] . ' ' .
				$professor['title_behind']
				?>
			</td>
			<td class="center"><a class="actionIcon deleteAction" href="#" onClick="javascript:$.post(
						'<?= $this->url(array(
							'controller' => 'commission',
							'action' => 'remove-professor',
							'format' => 'html' 
						)
					) ?>',
					{
						pid: <?php echo $professor['pid']; ?>,
						cid: <?php echo $commission['cid'] ?>,						
					},
					function(result){						
						$('.message').html(result);						
						$('#<?php echo  $commission->getCid() . '-' . $professor->getPid(); ?>').remove();
					});">Odstrániť</a>				
			</td>			
		</tr>	
	<?php endforeach;?>
<?php endforeach;?>		
</table>
<div class="bottom">
	<?php 
	$this->form->getElement('cid')->setValue($commission['cid']);
	echo $this->form;
	?>
</div>